package com.help10000.rms.ui.activitys

import android.os.Bundle
import com.amir.common.beans.RepairInfo
import com.amir.common.utils.HideUtil
import com.amir.common.weight.DuplicateClickProxy
import com.help10000.rms.R
import com.help10000.rms.mvp.presenter.RefusePresenter
import com.help10000.rms.mvp.view.RefuseView
import com.help10000.rms.ui.base.BaseActivity
import com.help10000.rms.ui.utils.PageUtils
import kotlinx.android.synthetic.main.activity_refuse.*

/**
 * 拒绝订单
 */
class RefuseOrderActivity : BaseActivity<RefusePresenter, RefuseView>(), RefuseView {

    var repairInfo: RepairInfo? = null
    override fun getlayoutId(): Int {
        return R.layout.activity_refuse
    }

    override fun initView() {
        et_reason.requestFocus()
        HideUtil.openKeyboard(this, et_reason)
    }

    override fun initData(savedInstanceState: Bundle?) {
        repairInfo = intent.getSerializableExtra("data") as RepairInfo

    }

    override fun initListener() {
        btn_save.setOnClickListener(DuplicateClickProxy{
            mPresenter.submit(repairInfo?.ID, et_reason.text.toString(), activity = this)
        })
    }

    override fun createPresenter(): RefusePresenter {
        return RefusePresenter(this)
    }

    override fun refuseSuccess() {
        PageUtils.jumpToResult(this, OrderActivity::class.java, true, "拒绝成功")
    }
}